/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.constant.tareas;

import javax.swing.SwingWorker;
import org.constant.gui.Principal;

/**
 *
 * @author gsierra
 */
public class TareaSegundoPlano extends SwingWorker<String, Void> {

    private final Principal principal;

    public TareaSegundoPlano(Principal principal) {
        this.principal = principal;
    }

    @Override
    protected String doInBackground() throws Exception {
        principal.reestablece(Boolean.FALSE);
        principal.escaneaDispositivos();
        return "Operacion finalizada";
    }

    @Override
    public void done() {
        try {
            principal.reestablece(Boolean.TRUE);
            principal.activaArbol();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
